home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / semctl.man < prev    next >
Encoding:
Text File  |  1991-03-31  |  6.9 KB  |  199 lines

  1.  
  2.  
  3.  
  4. SEMCTL                C Library Procedures                 SEMCTL
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      semctl - semaphore control operations
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
  13.      ##iinncclluuddee <<ssyyss//iippcc..hh>>
  14.      ##iinncclluuddee <<ssyyss//sseemm..hh>>
  15.  
  16.      iinntt sseemmccttll ((sseemmiidd,, sseemmnnuumm,, ccmmdd,, aarrgg))
  17.      iinntt sseemmiidd,, ccmmdd;;
  18.      iinntt sseemmnnuumm;;
  19.      uunniioonn sseemmuunn {{
  20.           vvaall;;
  21.           ssttrruucctt sseemmiidd__ddss **bbuuff;;
  22.           uusshhoorrtt **aarrrraayy;;
  23.      }} aarrgg;;
  24.  
  25. DDEESSCCRRIIPPTTIIOONN
  26.      sseemmccttll(()) provides a variety of semaphore control operations
  27.      as specified by _c_m_d.
  28.  
  29.      The following _c_m_ds are executed with respect to the sema-
  30.      phore specified by _s_e_m_i_d and _s_e_m_n_u_m:
  31.  
  32.           GGEETTVVAALL              Return the value of _s_e_m_v_a_l (see
  33.                               iinnttrroo(2)).  {{RREEAADD}}
  34.  
  35.           SSEETTVVAALL              Set the value of _s_e_m_v_a_l to _a_r_g._v_a_l.
  36.                               {{AALLTTEERR}}
  37.  
  38.           GGEETTPPIIDD              Return the value of _s_e_m_p_i_d.  {{RREEAADD}}
  39.  
  40.           GGEETTNNCCNNTT             Return the value of _s_e_m_n_c_n_t.
  41.                               {{RREEAADD}}
  42.  
  43.           GGEETTZZCCNNTT             Return the value of _s_e_m_z_c_n_t.
  44.                               {{RREEAADD}}
  45.  
  46.      The following _c_m_ds return and set, respectively, every _s_e_m_-
  47.      _v_a_l in the set of semaphores.
  48.  
  49.           GGEETTKKEEYYSS
  50.                Place the partial contents of all semaphore
  51.                entries into the array pointed to by _a_r_g._b_u_f .
  52.  
  53.           GGEETTAALLLL
  54.                Place _s_e_m_v_a_l_s into the array pointed to by
  55.                _a_r_g._a_r_r_a_y.  {{RREEAADD}}
  56.  
  57.           SSEETTAALLLL
  58.                Set _s_e_m_v_a_l_s according to the array pointed to by
  59.                _a_r_g._a_r_r_a_y.  {{AALLTTEERR}}
  60.  
  61.  
  62.  
  63. Sprite v1.0             21 November 1987                        1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SEMCTL                C Library Procedures                 SEMCTL
  71.  
  72.  
  73.  
  74.      The following _c_m_ds are also available:
  75.  
  76.           IIPPCC__SSTTAATT            Place the current value of each
  77.                               member of the data structure asso-
  78.                               ciated with _s_e_m_i_d into the struc-
  79.                               ture pointed to by _a_r_g._b_u_f.  The
  80.                               contents of this structure are
  81.                               defined in iinnttrroo(2).  {{RREEAADD}}
  82.  
  83.           IIPPCC__SSEETT             Set the value of the following
  84.                               members of the data structure asso-
  85.                               ciated with _s_e_m_i_d to the
  86.                               corresponding value found in the
  87.                               structure pointed to by _a_r_g._b_u_f:
  88.  
  89.  
  90.                               sseemm__ppeerrmm..uuiidd
  91.                               sseemm__ppeerrmm..ggiidd
  92.                               sseemm__ppeerrmm..mmooddee //** oonnllyy llooww 99 bbiittss **//
  93.  
  94.                               This _c_m_d can only be executed by a
  95.                               process that has an effective user
  96.                               ID equal to either that of super-
  97.                               user, or to the value of
  98.                               sseemm__ppeerrmm..ccuuiidd or sseemm__ppeerrmm..uuiidd in
  99.                               the data structure associated with
  100.                               _s_e_m_i_d.
  101.  
  102.           IIPPCC__RRMMIIDD            Remove the semaphore identifier
  103.                               specified by _s_e_m_i_d from the system
  104.                               and destroy the set of semaphores
  105.                               and data structure associated with
  106.                               it.  This cmd can only be executed
  107.                               by a process that has an effective
  108.                               user ID equal to either that of
  109.                               super-user, or to the value of
  110.                               sseemm__ppeerrmm..ccuuiidd or sseemm__ppeerrmm..uuiidd in
  111.                               the data structure associated with
  112.                               _s_e_m_i_d.
  113.  
  114. RREETTUURRNN VVAALLUUEE
  115.      Upon successful completion, the value returned depends on
  116.      _c_m_d as follows:
  117.           GGEETTVVAALL              The value of _s_e_m_v_a_l.
  118.           GGEETTPPIIDD              The value of _s_e_m_p_i_d.
  119.           GGEETTNNCCNNTT             The value of _s_e_m_n_c_n_t.
  120.           GGEETTZZCCNNTT             The value of _s_e_m_z_c_n_t.
  121.           All others          A value of 0.
  122.      Otherwise, a value of -1 is returned and eerrrrnnoo is set to
  123.      indicate the error.
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0             21 November 1987                        2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SEMCTL                C Library Procedures                 SEMCTL
  137.  
  138.  
  139.  
  140. EERRRROORRSS
  141.      sseemmccttll(()) will fail if one or more of the following are true:
  142.  
  143.      EINVAL              _s_e_m_i_d is not a valid semaphore identif-
  144.                          ier.
  145.  
  146.      EINVAL              _s_e_m_n_u_m is less than zero or greater than
  147.                          sseemm__nnsseemmss.
  148.  
  149.      EINVAL              _c_m_d is not a valid command.
  150.  
  151.      EACCES              Operation permission is denied to the
  152.                          calling process (see iinnttrroo(2)).
  153.  
  154.      ERANGE              _c_m_d is SSEETTVVAALL or SSEETTAALLLL and the value to
  155.                          which _s_e_m_v_a_l is to be set is greater
  156.                          than the system imposed maximum.
  157.  
  158.      EPERM               _c_m_d is equal to IIPPCC__RRMMIIDD or IIPPCC__SSEETT and
  159.                          the effective user ID of the calling
  160.                          process is not equal to that of super-
  161.                          user, or to the value of sseemm__ppeerrmm..ccuuiidd
  162.                          or sseemm__ppeerrmm..uuiidd in the data structure
  163.                          associated with _s_e_m_i_d.
  164.  
  165.      EFAULT              _a_r_g._b_u_f points to an illegal address.
  166.  
  167. SSEEEE AALLSSOO
  168.      iinnttrroo(2), sseemmggeett(2), sseemmoopp(2).
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0             21 November 1987                        3
  196.  
  197.  
  198.  
  199.